package com.waylau.spring.cloud.weather.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.waylau.spring.cloud.weather.service.WeatherDataService;
import com.waylau.spring.cloud.weather.vo.WeatherResponse;

/**
 * @author baike
 */
@RestController
@RequestMapping("/weather")
public class WeatherController {
	
	@Autowired
	private WeatherDataService weatherDataService;

	@RequestMapping("/cityId")
	public WeatherResponse getWeatherByCityId(String cityId){
		return weatherDataService.getDataByCityId(cityId);
	} 
	
	@RequestMapping("/cityName")
	public WeatherResponse getWeatherByCityName(String cityName){
		return weatherDataService.getDataBycityName(cityName);
	}
}
